STI tools v. 1.0 of January 2002
by Snap <tacpans@yahoo.com>

The following is a collection of command-line (DOS) utilities for
working with Sirtech multi-page STI files.  I made these programs
because I needed a fast way of working with STIs, particularly when
copying multiple tiles from one STI to another.

In all programs indexing of pages in STI files starts with 0.  STIs
are always edited in-place (no backups are made).

instiles target.sti source.sti target_idx source_idx [count]
       Copy pages from source.sti to target.sti
       Pages are inserted at index "target_idx" in target.sti.
       Copying starts at index "source_idx" in source.sti.
       The number of pages to copy is specified in "count" (default is one).
       
       Colours of the inserted images are adjusted to the palette of the
       target file.  Page offsets are preserved.
       
       Example: instiles dump.sti block.sti 8 0 4
       Copy 4 pages from block.sti (starting from the beginning of the file),
       and insert them into dump.sti at index 8.  (Since dump.sti originally
       contained 8 pages, the new pages are appended at the end of the file.)
         
deltiles file.sti index count
       Delete count pages in file.sti starting at index.
       
imppal file.sti palette.act
       Import a Photoshop (.ACT) palette*.  Images in the STI are adjusted
       to the new palette.

exppal file.sti [palette.act]
       Export a Photoshop (.ACT) palette*.  The default output file is file.act.
       
chtransp file.sti red green blue
       Change the transparent colour. "red", "green", "blue" are RGB
       components (0-255).
       
picktransp file.sti red green blue
       Make one of the colours in the STI palette transparent.  The colour
       must exist in the palette.
       
       Example: Suppose the current transparent colour is (0, 0, 0) (black).
       If there is another colour, say (0, 0, 255) (blue) in the palette, you
       can make that colour transparent instead of black.  Pixels that were
       previously transparent will now be black, while pixels that were
       previously blue will now be transparent.
       
       This is sometimes useful when you import a palette.  STI always treats
       the first colour in the palette as transparent.  However, in a palette
       obtained  from Photoshop or some other imaging program, the first
       colour may not necessarily be the colour that you want to be
       transparent.


* Photoshop palette:
There is no version number written in the file. The file is exactly
768 bytes long, and contains 256 RGB colors. There are three bytes per
color in the order Red, Green, Blue.